#include "FrontEndState.h"

FrontEndState::FrontEndState(GameContext& gameC)
	:	GameState(gameC)
{

}
FrontEndState::~FrontEndState()
{
}
void FrontEndState::Load()
{
	float xPos(IniFile_GetInt("WinWidth", 800)/2);
	xPos -= 80;
	mBgSprite.Load("front_bg.jpg");
	//mFont.Load(20);
	mCursor.Load("sword.png");

	mStartButton1.Load("button_on.png", "button_off.png");
	mStartButton1.SetPosition(SGE::SVector2(xPos, 425.0f));
	mStartButton1.SetText("Level 1", 255,255,255);

	/*mStartButton2.Load("button_on.png", "button_off.png");
	mStartButton2.SetPosition(SGE::SVector2(xPos, 450.0f));
	mStartButton2.SetText("Level 2", 255,255,255);*/

	mQuitButton.Load("button_on.png", "button_off.png");
	mQuitButton.SetPosition(SGE::SVector2(xPos, 500.0f));
	mQuitButton.SetText("quit", 255,255,255);
}
void FrontEndState::Unload()
{
	mBgSprite.Unload();
	//mFont.Unload();
	mCursor.Unload();
	mStartButton1.Unload();
	//mStartButton2.Unload();
	mQuitButton.Unload();

}
NextStates FrontEndState::Update(float deltaTime)
{
	mCursor.Update(deltaTime);
	mStartButton1.Update(deltaTime);
	//mStartButton2.Update(deltaTime);
	mQuitButton.Update(deltaTime);
	mBgSprite.Update(deltaTime);
	NextStates nextState = None;
	if(mStartButton1.IsPressed())
	{
		nextState = Gameplay;
	}
	/*else if(mStartButton2.IsPressed())
	{
		nextState = Gameplay;
	}*/
	else if(mQuitButton.IsPressed())
	{
		nextState = Quit;
	}
	return nextState;
}
void FrontEndState::Render()
{
	mBgSprite.Render();
	//mFont.Print("Tiles Tactics 2.0", 100,100);
	mStartButton1.Render();
	//mStartButton2.Render();
	mQuitButton.Render();
	mCursor.Render();
}